home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK2.toast / Development Kits / QuickTime / QuickTime 3 Interfaces & Libs / QTDevWin / CIncludes / CMApplication.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  40.8 KB  |  1,203 lines  |  [TEXT/dosa]

  1. /*
  2.      File:        CMApplication.h
  3.  
  4.      Contains:    ColorSync API
  5.  
  6.      Version:    Technology:    ColorSync 2.5
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1992-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __CMAPPLICATION__
  19. #define __CMAPPLICATION__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30. #ifndef __PRINTING__
  31. #include <Printing.h>
  32. #endif
  33. #ifndef __CMICCPROFILE__
  34. #include <CMICCProfile.h>
  35. #endif
  36. #ifndef __DISPLAYS__
  37. #include <Displays.h>
  38. #endif
  39.  
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=mac68k
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62.  
  63. enum {
  64.     kDefaultCMMSignature        = FOUR_CHAR_CODE('appl')
  65. };
  66.  
  67. /* Macintosh 68K trap word */
  68.  
  69. enum {
  70.     cmTrap                        = 0xABEE
  71. };
  72.  
  73.  
  74. /* PicComment IDs */
  75.  
  76. enum {
  77.     cmBeginProfile                = 220,
  78.     cmEndProfile                = 221,
  79.     cmEnableMatching            = 222,
  80.     cmDisableMatching            = 223,
  81.     cmComment                    = 224
  82. };
  83.  
  84. /* PicComment selectors for cmComment */
  85.  
  86. enum {
  87.     cmBeginProfileSel            = 0,
  88.     cmContinueProfileSel        = 1,
  89.     cmEndProfileSel                = 2,
  90.     cmProfileIdentifierSel        = 3
  91. };
  92.  
  93.  
  94. /* Defines for version 1.0 CMProfileSearchRecord.fieldMask */
  95.  
  96. enum {
  97.     cmMatchCMMType                = 0x00000001,
  98.     cmMatchApplProfileVersion    = 0x00000002,
  99.     cmMatchDataType                = 0x00000004,
  100.     cmMatchDeviceType            = 0x00000008,
  101.     cmMatchDeviceManufacturer    = 0x00000010,
  102.     cmMatchDeviceModel            = 0x00000020,
  103.     cmMatchDeviceAttributes        = 0x00000040,
  104.     cmMatchFlags                = 0x00000080,
  105.     cmMatchOptions                = 0x00000100,
  106.     cmMatchWhite                = 0x00000200,
  107.     cmMatchBlack                = 0x00000400
  108. };
  109.  
  110. /* Defines for version 2.0 CMSearchRecord.searchMask */
  111.  
  112. enum {
  113.     cmMatchAnyProfile            = 0x00000000,
  114.     cmMatchProfileCMMType        = 0x00000001,
  115.     cmMatchProfileClass            = 0x00000002,
  116.     cmMatchDataColorSpace        = 0x00000004,
  117.     cmMatchProfileConnectionSpace = 0x00000008,
  118.     cmMatchManufacturer            = 0x00000010,
  119.     cmMatchModel                = 0x00000020,
  120.     cmMatchAttributes            = 0x00000040,
  121.     cmMatchProfileFlags            = 0x00000080
  122. };
  123.  
  124. /* Result codes */
  125.  
  126. enum {
  127.                                                                 /* General Errors */
  128.     cmProfileError                = -170,
  129.     cmMethodError                = -171,
  130.     cmMethodNotFound            = -175,                            /* CMM not present */
  131.     cmProfileNotFound            = -176,                            /* Responder error */
  132.     cmProfilesIdentical            = -177,                            /* Profiles the same */
  133.     cmCantConcatenateError        = -178,                            /* Profile can't be concatenated */
  134.     cmCantXYZ                    = -179,                            /* CMM cant handle XYZ space */
  135.     cmCantDeleteProfile            = -180,                            /* Responder error */
  136.     cmUnsupportedDataType        = -181,                            /* Responder error */
  137.     cmNoCurrentProfile            = -182,                            /* Responder error */
  138.                                                                 /* Profile Access Errors */
  139.     cmElementTagNotFound        = -4200,
  140.     cmIndexRangeErr                = -4201,                        /* Tag index out of range */
  141.     cmCantDeleteElement            = -4202,
  142.     cmFatalProfileErr            = -4203,
  143.     cmInvalidProfile            = -4204,                        /* A Profile must contain a 'cs1 ' tag to be valid */
  144.     cmInvalidProfileLocation    = -4205,                        /* Operation not supported for this profile location */
  145.     cmCantCopyModifiedV1Profile    = -4215,                        /* Illegal to copy version 1 profiles that have been modified */
  146.                                                                 /* Profile Search Errors */
  147.     cmInvalidSearch                = -4206,                        /* Bad Search Handle */
  148.     cmSearchError                = -4207,
  149.     cmErrIncompatibleProfile    = -4208,                        /* Other ColorSync Errors */
  150.     cmInvalidColorSpace            = -4209,                        /* Profile colorspace does not match bitmap type */
  151.     cmInvalidSrcMap                = -4210,                        /* Source pix/bit map was invalid */
  152.     cmInvalidDstMap                = -4211,                        /* Destination pix/bit map was invalid */
  153.     cmNoGDevicesError            = -4212,                        /* Begin/End Matching -- no gdevices available */
  154.     cmInvalidProfileComment        = -4213,                        /* Bad Profile comment during drawpicture */
  155.     cmRangeOverFlow                = -4214,                        /* Color conversion warning that some output color values over/underflowed and were clipped */
  156.     cmNamedColorNotFound        = -4216,                        /* NamedColor not found */
  157.     cmCantGamutCheckError        = -4217                            /* Gammut checking not supported by this ColorWorld */
  158. };
  159.  
  160. /* deviceType values for ColorSync 1.0 Device Profile access */
  161.  
  162. enum {
  163.     cmSystemDevice                = FOUR_CHAR_CODE('sys '),
  164.     cmGDevice                    = FOUR_CHAR_CODE('gdev')
  165. };
  166.  
  167. /* Commands for CMFlattenUPP(…) */
  168.  
  169. enum {
  170.     cmOpenReadSpool                = 1,
  171.     cmOpenWriteSpool            = 2,
  172.     cmReadSpool                    = 3,
  173.     cmWriteSpool                = 4,
  174.     cmCloseSpool                = 5
  175. };
  176.  
  177. /* Flags for PostScript-related functions */
  178.  
  179. enum {
  180.     cmPS7bit                    = 1,
  181.     cmPS8bit                    = 2
  182. };
  183.  
  184. /* Flags for profile embedding functions */
  185.  
  186. enum {
  187.     cmEmbedWholeProfile            = 0x00000000,
  188.     cmEmbedProfileIdentifier    = 0x00000001
  189. };
  190.  
  191. /* Commands for CMAccessUPP(…) */
  192.  
  193. enum {
  194.     cmOpenReadAccess            = 1,
  195.     cmOpenWriteAccess            = 2,
  196.     cmReadAccess                = 3,
  197.     cmWriteAccess                = 4,
  198.     cmCloseAccess                = 5,
  199.     cmCreateNewAccess            = 6,
  200.     cmAbortWriteAccess            = 7,
  201.     cmBeginAccess                = 8,
  202.     cmEndAccess                    = 9
  203. };
  204.  
  205.  
  206. /* Abstract data type for memory-based Profile */
  207. typedef struct OpaqueCMProfileRef*         CMProfileRef;
  208. /* Abstract data type for Profile search result */
  209. typedef struct OpaqueCMProfileSearchRef*  CMProfileSearchRef;
  210. /* Abstract data type for BeginMatching(…) reference */
  211. typedef struct OpaqueCMMatchRef*         CMMatchRef;
  212. /* Abstract data type for ColorWorld reference */
  213. typedef struct OpaqueCMWorldRef*         CMWorldRef;
  214. /* Caller-supplied flatten function */
  215. typedef CALLBACK_API( OSErr , CMFlattenProcPtr )(long command, long *size, void *data, void *refCon);
  216. /* Caller-supplied progress function for Bitmap & PixMap matching routines */
  217. typedef CALLBACK_API( Boolean , CMBitmapCallBackProcPtr )(long progress, void *refCon);
  218. /* Caller-supplied filter function for Profile search */
  219. typedef CALLBACK_API( Boolean , CMProfileFilterProcPtr )(CMProfileRef prof, void *refCon);
  220. /* Caller-supplied function for profile access */
  221. typedef CALLBACK_API( OSErr , CMProfileAccessProcPtr )(long command, long offset, long *size, void *data, void *refCon);
  222. typedef STACK_UPP_TYPE(CMFlattenProcPtr)                         CMFlattenUPP;
  223. typedef STACK_UPP_TYPE(CMBitmapCallBackProcPtr)                 CMBitmapCallBackUPP;
  224. typedef STACK_UPP_TYPE(CMProfileFilterProcPtr)                     CMProfileFilterUPP;
  225. typedef STACK_UPP_TYPE(CMProfileAccessProcPtr)                     CMProfileAccessUPP;
  226. enum { uppCMFlattenProcInfo = 0x00003FE0 };                     /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  227. enum { uppCMBitmapCallBackProcInfo = 0x000003D0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes) */
  228. enum { uppCMProfileFilterProcInfo = 0x000003D0 };                 /* pascal 1_byte Func(4_bytes, 4_bytes) */
  229. enum { uppCMProfileAccessProcInfo = 0x0000FFE0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  230. #define NewCMFlattenProc(userRoutine)                             (CMFlattenUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMFlattenProcInfo, GetCurrentArchitecture())
  231. #define NewCMBitmapCallBackProc(userRoutine)                     (CMBitmapCallBackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMBitmapCallBackProcInfo, GetCurrentArchitecture())
  232. #define NewCMProfileFilterProc(userRoutine)                     (CMProfileFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileFilterProcInfo, GetCurrentArchitecture())
  233. #define NewCMProfileAccessProc(userRoutine)                     (CMProfileAccessUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileAccessProcInfo, GetCurrentArchitecture())
  234. #define CallCMFlattenProc(userRoutine, command, size, data, refCon)  CALL_FOUR_PARAMETER_UPP((userRoutine), uppCMFlattenProcInfo, (command), (size), (data), (refCon))
  235. #define CallCMBitmapCallBackProc(userRoutine, progress, refCon)  CALL_TWO_PARAMETER_UPP((userRoutine), uppCMBitmapCallBackProcInfo, (progress), (refCon))
  236. #define CallCMProfileFilterProc(userRoutine, prof, refCon)         CALL_TWO_PARAMETER_UPP((userRoutine), uppCMProfileFilterProcInfo, (prof), (refCon))
  237. #define CallCMProfileAccessProc(userRoutine, command, offset, size, data, refCon)  CALL_FIVE_PARAMETER_UPP((userRoutine), uppCMProfileAccessProcInfo, (command), (offset), (size), (data), (refCon))
  238. typedef long                             CMError;
  239. /* For 1.0 and 2.0 profile header variants */
  240. /* CMAppleProfileHeader */
  241.  
  242. union CMAppleProfileHeader {
  243.     CMHeader                         cm1;
  244.     CM2Header                         cm2;
  245. };
  246. typedef union CMAppleProfileHeader        CMAppleProfileHeader;
  247. /* Param for CWConcatColorWorld(…) */
  248.  
  249. struct CMConcatProfileSet {
  250.     unsigned short                     keyIndex;                    /* Zero-based */
  251.     unsigned short                     count;                        /* Min 1 */
  252.     CMProfileRef                     profileSet[1];                /* Variable. Ordered from Source -> Dest */
  253. };
  254. typedef struct CMConcatProfileSet        CMConcatProfileSet;
  255. /* ColorSync color data types */
  256.  
  257. struct CMRGBColor {
  258.     unsigned short                     red;                        /* 0..65535 */
  259.     unsigned short                     green;
  260.     unsigned short                     blue;
  261. };
  262. typedef struct CMRGBColor                CMRGBColor;
  263.  
  264. struct CMCMYKColor {
  265.     unsigned short                     cyan;                        /* 0..65535 */
  266.     unsigned short                     magenta;
  267.     unsigned short                     yellow;
  268.     unsigned short                     black;
  269. };
  270. typedef struct CMCMYKColor                CMCMYKColor;
  271.  
  272. struct CMCMYColor {
  273.     unsigned short                     cyan;                        /* 0..65535 */
  274.     unsigned short                     magenta;
  275.     unsigned short                     yellow;
  276. };
  277. typedef struct CMCMYColor                CMCMYColor;
  278.  
  279. struct CMHLSColor {
  280.     unsigned short                     hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  281.     unsigned short                     lightness;                    /* 0..65535 */
  282.     unsigned short                     saturation;                    /* 0..65535 */
  283. };
  284. typedef struct CMHLSColor                CMHLSColor;
  285.  
  286. struct CMHSVColor {
  287.     unsigned short                     hue;                        /* 0..65535. Fraction of circle. Red at 0 */
  288.     unsigned short                     saturation;                    /* 0..65535 */
  289.     unsigned short                     value;                        /* 0..65535 */
  290. };
  291. typedef struct CMHSVColor                CMHSVColor;
  292.  
  293. struct CMLabColor {
  294.     unsigned short                     L;                            /* 0..65535 maps to 0..100 */
  295.     unsigned short                     a;                            /* 0..65535 maps to -128..127.996 */
  296.     unsigned short                     b;                            /* 0..65535 maps to -128..127.996 */
  297. };
  298. typedef struct CMLabColor                CMLabColor;
  299.  
  300. struct CMLuvColor {
  301.     unsigned short                     L;                            /* 0..65535 maps to 0..100 */
  302.     unsigned short                     u;                            /* 0..65535 maps to -128..127.996 */
  303.     unsigned short                     v;                            /* 0..65535 maps to -128..127.996 */
  304. };
  305. typedef struct CMLuvColor                CMLuvColor;
  306.  
  307. struct CMYxyColor {
  308.     unsigned short                     capY;                        /* 0..65535 maps to 0..1 */
  309.     unsigned short                     x;                            /* 0..65535 maps to 0..1 */
  310.     unsigned short                     y;                            /* 0..65535 maps to 0..1 */
  311. };
  312. typedef struct CMYxyColor                CMYxyColor;
  313.  
  314. struct CMGrayColor {
  315.     unsigned short                     gray;                        /* 0..65535 */
  316. };
  317. typedef struct CMGrayColor                CMGrayColor;
  318.  
  319. struct CMMultichannel5Color {
  320.     unsigned char                     components[5];                /* 0..255 */
  321. };
  322. typedef struct CMMultichannel5Color        CMMultichannel5Color;
  323.  
  324. struct CMMultichannel6Color {
  325.     unsigned char                     components[6];                /* 0..255 */
  326. };
  327. typedef struct CMMultichannel6Color        CMMultichannel6Color;
  328.  
  329. struct CMMultichannel7Color {
  330.     unsigned char                     components[7];                /* 0..255 */
  331. };
  332. typedef struct CMMultichannel7Color        CMMultichannel7Color;
  333.  
  334. struct CMMultichannel8Color {
  335.     unsigned char                     components[8];                /* 0..255 */
  336. };
  337. typedef struct CMMultichannel8Color        CMMultichannel8Color;
  338.  
  339. struct CMNamedColor {
  340.     unsigned long                     namedColorIndex;            /* 0..a lot */
  341. };
  342. typedef struct CMNamedColor                CMNamedColor;
  343.  
  344. union CMColor {
  345.     CMRGBColor                         rgb;
  346.     CMHSVColor                         hsv;
  347.     CMHLSColor                         hls;
  348.     CMXYZColor                         XYZ;
  349.     CMLabColor                         Lab;
  350.     CMLuvColor                         Luv;
  351.     CMYxyColor                         Yxy;
  352.     CMCMYKColor                     cmyk;
  353.     CMCMYColor                         cmy;
  354.     CMGrayColor                     gray;
  355.     CMMultichannel5Color             mc5;
  356.     CMMultichannel6Color             mc6;
  357.     CMMultichannel7Color             mc7;
  358.     CMMultichannel8Color             mc8;
  359.     CMNamedColor                     namedColor;
  360. };
  361. typedef union CMColor                    CMColor;
  362.  
  363. struct CMProfileSearchRecord {
  364.     CMHeader                         header;
  365.     unsigned long                     fieldMask;
  366.     unsigned long                     reserved[2];
  367. };
  368. typedef struct CMProfileSearchRecord    CMProfileSearchRecord;
  369. typedef CMProfileSearchRecord *            CMProfileSearchRecordPtr;
  370. typedef CMProfileSearchRecordPtr *        CMProfileSearchRecordHandle;
  371. /* Search definition for 2.0 */
  372.  
  373. struct CMSearchRecord {
  374.     OSType                             CMMType;
  375.     OSType                             profileClass;
  376.     OSType                             dataColorSpace;
  377.     OSType                             profileConnectionSpace;
  378.     unsigned long                     deviceManufacturer;
  379.     unsigned long                     deviceModel;
  380.     unsigned long                     deviceAttributes[2];
  381.     unsigned long                     profileFlags;
  382.     unsigned long                     searchMask;
  383.     CMProfileFilterUPP                 filter;
  384. };
  385. typedef struct CMSearchRecord            CMSearchRecord;
  386. /* GetCWInfo structures */
  387.  
  388. struct CMMInfoRecord {
  389.     OSType                             CMMType;
  390.     long                             CMMVersion;
  391. };
  392. typedef struct CMMInfoRecord            CMMInfoRecord;
  393.  
  394. struct CMCWInfoRecord {
  395.     unsigned long                     cmmCount;
  396.     CMMInfoRecord                     cmmInfo[2];
  397. };
  398. typedef struct CMCWInfoRecord            CMCWInfoRecord;
  399. /* profile identifier structures */
  400.  
  401. struct CMProfileIdentifier {
  402.     CM2Header                         profileHeader;
  403.     CMDateTime                         calibrationDate;
  404.     unsigned long                     ASCIIProfileDescriptionLen;
  405.     char                             ASCIIProfileDescription[1];    /* variable length */
  406. };
  407. typedef struct CMProfileIdentifier        CMProfileIdentifier;
  408. typedef CMProfileIdentifier *            CMProfileIdentifierPtr;
  409. /* packing formats */
  410.  
  411. enum {
  412.     cmNoColorPacking            = 0x0000,
  413.     cmAlphaSpace                = 0x0080,
  414.     cmWord5ColorPacking            = 0x0500,
  415.     cmLong8ColorPacking            = 0x0800,
  416.     cmLong10ColorPacking        = 0x0A00,
  417.     cmAlphaFirstPacking            = 0x1000,
  418.     cmOneBitDirectPacking        = 0x0B00,
  419.     cmAlphaLastPacking            = 0x0000,
  420.     cm24_8ColorPacking            = 0x2100,
  421.     cm32_8ColorPacking            = cmLong8ColorPacking,
  422.     cm40_8ColorPacking            = 0x2200,
  423.     cm48_8ColorPacking            = 0x2300,
  424.     cm56_8ColorPacking            = 0x2400,
  425.     cm64_8ColorPacking            = 0x2500,
  426.     cm32_16ColorPacking            = 0x2600,
  427.     cm48_16ColorPacking            = 0x2900,
  428.     cm64_16ColorPacking            = 0x2A00,
  429.     cm32_32ColorPacking            = 0x2700
  430. };
  431.  
  432. /* general colorspaces */
  433.  
  434. enum {
  435.     cmNoSpace                    = 0,
  436.     cmRGBSpace                    = 1,
  437.     cmCMYKSpace                    = 2,
  438.     cmHSVSpace                    = 3,
  439.     cmHLSSpace                    = 4,
  440.     cmYXYSpace                    = 5,
  441.     cmXYZSpace                    = 6,
  442.     cmLUVSpace                    = 7,
  443.     cmLABSpace                    = 8,
  444.     cmReservedSpace1            = 9,
  445.     cmGraySpace                    = 10,
  446.     cmReservedSpace2            = 11,
  447.     cmGamutResultSpace            = 12,
  448.     cmNamedIndexedSpace            = 16,
  449.     cmMCFiveSpace                = 17,
  450.     cmMCSixSpace                = 18,
  451.     cmMCSevenSpace                = 19,
  452.     cmMCEightSpace                = 20,
  453.     cmRGBASpace                    = cmRGBSpace + cmAlphaSpace,
  454.     cmGrayASpace                = cmGraySpace + cmAlphaSpace
  455. };
  456.  
  457. /* supported CMBitmapColorSpaces - each of the following is a */
  458. /* combination of a general colospace and a packing formats */
  459.  
  460. enum {
  461.     cmGray16Space                = cmGraySpace,
  462.     cmGrayA32Space                = cmGrayASpace,
  463.     cmRGB16Space                = cmWord5ColorPacking + cmRGBSpace,
  464.     cmRGB24Space                = cm24_8ColorPacking + cmRGBSpace,
  465.     cmRGB32Space                = cm32_8ColorPacking + cmRGBSpace,
  466.     cmRGB48Space                = cm48_16ColorPacking + cmRGBSpace,
  467.     cmARGB32Space                = cm32_8ColorPacking + cmAlphaFirstPacking + cmRGBASpace,
  468.     cmRGBA32Space                = cm32_8ColorPacking + cmAlphaLastPacking + cmRGBASpace,
  469.     cmCMYK32Space                = cm32_8ColorPacking + cmCMYKSpace,
  470.     cmCMYK64Space                = cm64_16ColorPacking + cmCMYKSpace,
  471.     cmHSV32Space                = cmLong10ColorPacking + cmHSVSpace,
  472.     cmHLS32Space                = cmLong10ColorPacking + cmHLSSpace,
  473.     cmYXY32Space                = cmLong10ColorPacking + cmYXYSpace,
  474.     cmXYZ32Space                = cmLong10ColorPacking + cmXYZSpace,
  475.     cmLUV32Space                = cmLong10ColorPacking + cmLUVSpace,
  476.     cmLAB24Space                = cm24_8ColorPacking + cmLABSpace,
  477.     cmLAB32Space                = cmLong10ColorPacking + cmLABSpace,
  478.     cmLAB48Space                = cm48_16ColorPacking + cmLABSpace,
  479.     cmGamutResult1Space            = cmOneBitDirectPacking + cmGamutResultSpace,
  480.     cmNamedIndexed32Space        = cm32_32ColorPacking + cmNamedIndexedSpace,
  481.     cmMCFive8Space                = cm40_8ColorPacking + cmMCFiveSpace,
  482.     cmMCSix8Space                = cm48_8ColorPacking + cmMCSixSpace,
  483.     cmMCSeven8Space                = cm56_8ColorPacking + cmMCSevenSpace,
  484.     cmMCEight8Space                = cm64_8ColorPacking + cmMCEightSpace
  485. };
  486.  
  487.  
  488.  
  489. typedef unsigned long                     CMBitmapColorSpace;
  490.  
  491. struct CMBitmap {
  492.     char *                            image;
  493.     long                             width;
  494.     long                             height;
  495.     long                             rowBytes;
  496.     long                             pixelSize;
  497.     CMBitmapColorSpace                 space;
  498.     long                             user1;
  499.     long                             user2;
  500. };
  501. typedef struct CMBitmap                    CMBitmap;
  502.  
  503. /* Classic Print Manager Stuff */
  504.  
  505. enum {
  506.     enableColorMatchingOp        = 12,
  507.     registerProfileOp            = 13
  508. };
  509.  
  510.  
  511. enum {
  512.     cmNoProfileBase                = 0,
  513.     cmFileBasedProfile            = 1,
  514.     cmHandleBasedProfile        = 2,
  515.     cmPtrBasedProfile            = 3,
  516.     cmProcedureBasedProfile        = 4
  517. };
  518.  
  519.  
  520. struct CMFileLocation {
  521.     FSSpec                             spec;
  522. };
  523. typedef struct CMFileLocation            CMFileLocation;
  524.  
  525. struct CMHandleLocation {
  526.     Handle                             h;
  527. };
  528. typedef struct CMHandleLocation            CMHandleLocation;
  529.  
  530. struct CMPtrLocation {
  531.     Ptr                             p;
  532. };
  533. typedef struct CMPtrLocation            CMPtrLocation;
  534.  
  535. struct CMProcedureLocation {
  536.     CMProfileAccessUPP                 proc;
  537.     void *                            refCon;
  538. };
  539. typedef struct CMProcedureLocation        CMProcedureLocation;
  540.  
  541.  
  542. union CMProfLoc {
  543.     CMFileLocation                     fileLoc;
  544.     CMHandleLocation                 handleLoc;
  545.     CMPtrLocation                     ptrLoc;
  546.     CMProcedureLocation             procLoc;
  547. };
  548. typedef union CMProfLoc                    CMProfLoc;
  549.  
  550. struct CMProfileLocation {
  551.     short                             locType;
  552.     CMProfLoc                         u;
  553. };
  554. typedef struct CMProfileLocation        CMProfileLocation;
  555.  
  556. enum {
  557.     cmOriginalProfileLocationSize = 72,
  558.     cmCurrentProfileLocationSize = 72
  559. };
  560.  
  561.  
  562. /* Struct and enums used for Profile iteration */
  563.  
  564. enum {
  565.     cmProfileIterateDataVersion1 = 0x00010000
  566. };
  567.  
  568.  
  569. struct CMProfileIterateData {
  570.     unsigned long                     dataVersion;                /* cmProfileIterateDataVersion1 */
  571.     CM2Header                         header;
  572.     ScriptCode                         code;
  573.     Str255                             name;
  574.     CMProfileLocation                 location;
  575. };
  576. typedef struct CMProfileIterateData        CMProfileIterateData;
  577. /* Caller-supplied callback function for Profile iteration */
  578. typedef CALLBACK_API( OSErr , CMProfileIterateProcPtr )(CMProfileIterateData *iterateData, void *refCon);
  579. typedef STACK_UPP_TYPE(CMProfileIterateProcPtr)                 CMProfileIterateUPP;
  580. enum { uppCMProfileIterateProcInfo = 0x000003E0 };                 /* pascal 2_bytes Func(4_bytes, 4_bytes) */
  581. #define NewCMProfileIterateProc(userRoutine)                     (CMProfileIterateUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppCMProfileIterateProcInfo, GetCurrentArchitecture())
  582. #define CallCMProfileIterateProc(userRoutine, iterateData, refCon)  CALL_TWO_PARAMETER_UPP((userRoutine), uppCMProfileIterateProcInfo, (iterateData), (refCon))
  583. /* Profile file and element access */
  584. EXTERN_API( CMError )
  585. CMNewProfile                    (CMProfileRef *            prof,
  586.                                  const CMProfileLocation * theProfile)                        FOURWORDINLINE(0x203C, 0x0008, 0x001B, 0xABEE);
  587.  
  588. EXTERN_API( CMError )
  589. CMOpenProfile                    (CMProfileRef *            prof,
  590.                                  const CMProfileLocation * theProfile)                        FOURWORDINLINE(0x203C, 0x0008, 0x001C, 0xABEE);
  591.  
  592. EXTERN_API( CMError )
  593. CMCloseProfile                    (CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x001D, 0xABEE);
  594.  
  595. EXTERN_API( CMError )
  596. CMUpdateProfile                    (CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x0034, 0xABEE);
  597.  
  598. EXTERN_API( CMError )
  599. CMCopyProfile                    (CMProfileRef *            targetProf,
  600.                                  const CMProfileLocation * targetLocation,
  601.                                  CMProfileRef             srcProf)                            FOURWORDINLINE(0x203C, 0x000C, 0x0025, 0xABEE);
  602.  
  603. EXTERN_API( CMError )
  604. CMValidateProfile                (CMProfileRef             prof,
  605.                                  Boolean *                valid,
  606.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x000C, 0x0026, 0xABEE);
  607.  
  608. EXTERN_API( CMError )
  609. CMGetProfileLocation            (CMProfileRef             prof,
  610.                                  CMProfileLocation *    theProfile)                            FOURWORDINLINE(0x203C, 0x0008, 0x003C, 0xABEE);
  611.  
  612. EXTERN_API( CMError )
  613. NCMGetProfileLocation            (CMProfileRef             prof,
  614.                                  CMProfileLocation *    theProfile,
  615.                                  unsigned long *        locationSize)                        FOURWORDINLINE(0x203C, 0x000C, 0x0059, 0xABEE);
  616.  
  617. EXTERN_API( CMError )
  618. CMFlattenProfile                (CMProfileRef             prof,
  619.                                  unsigned long             flags,
  620.                                  CMFlattenUPP             proc,
  621.                                  void *                    refCon,
  622.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0014, 0x0031, 0xABEE);
  623.  
  624. EXTERN_API( CMError )
  625. CMUnflattenProfile                (FSSpec *                resultFileSpec,
  626.                                  CMFlattenUPP             proc,
  627.                                  void *                    refCon,
  628.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0010, 0x0032, 0xABEE);
  629.  
  630. EXTERN_API( CMError )
  631. CMGetProfileHeader                (CMProfileRef             prof,
  632.                                  CMAppleProfileHeader *    header)                                FOURWORDINLINE(0x203C, 0x0008, 0x0039, 0xABEE);
  633.  
  634. EXTERN_API( CMError )
  635. CMSetProfileHeader                (CMProfileRef             prof,
  636.                                  const CMAppleProfileHeader * header)                        FOURWORDINLINE(0x203C, 0x0008, 0x003A, 0xABEE);
  637.  
  638. EXTERN_API( CMError )
  639. CMProfileElementExists            (CMProfileRef             prof,
  640.                                  OSType                 tag,
  641.                                  Boolean *                found)                                FOURWORDINLINE(0x203C, 0x000C, 0x001E, 0xABEE);
  642.  
  643. EXTERN_API( CMError )
  644. CMCountProfileElements            (CMProfileRef             prof,
  645.                                  unsigned long *        elementCount)                        FOURWORDINLINE(0x203C, 0x0008, 0x001F, 0xABEE);
  646.  
  647. EXTERN_API( CMError )
  648. CMGetProfileElement                (CMProfileRef             prof,
  649.                                  OSType                 tag,
  650.                                  unsigned long *        elementSize,
  651.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0010, 0x0020, 0xABEE);
  652.  
  653. EXTERN_API( CMError )
  654. CMSetProfileElement                (CMProfileRef             prof,
  655.                                  OSType                 tag,
  656.                                  unsigned long             elementSize,
  657.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0010, 0x0023, 0xABEE);
  658.  
  659. EXTERN_API( CMError )
  660. CMSetProfileElementSize            (CMProfileRef             prof,
  661.                                  OSType                 tag,
  662.                                  unsigned long             elementSize)                        FOURWORDINLINE(0x203C, 0x000C, 0x0038, 0xABEE);
  663.  
  664. EXTERN_API( CMError )
  665. CMSetProfileElementReference    (CMProfileRef             prof,
  666.                                  OSType                 elementTag,
  667.                                  OSType                 referenceTag)                        FOURWORDINLINE(0x203C, 0x000C, 0x0035, 0xABEE);
  668.  
  669. EXTERN_API( CMError )
  670. CMGetPartialProfileElement        (CMProfileRef             prof,
  671.                                  OSType                 tag,
  672.                                  unsigned long             offset,
  673.                                  unsigned long *        byteCount,
  674.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0014, 0x0036, 0xABEE);
  675.  
  676. EXTERN_API( CMError )
  677. CMSetPartialProfileElement        (CMProfileRef             prof,
  678.                                  OSType                 tag,
  679.                                  unsigned long             offset,
  680.                                  unsigned long             byteCount,
  681.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0014, 0x0037, 0xABEE);
  682.  
  683. EXTERN_API( CMError )
  684. CMGetIndProfileElementInfo        (CMProfileRef             prof,
  685.                                  unsigned long             index,
  686.                                  OSType *                tag,
  687.                                  unsigned long *        elementSize,
  688.                                  Boolean *                refs)                                FOURWORDINLINE(0x203C, 0x0014, 0x0021, 0xABEE);
  689.  
  690. EXTERN_API( CMError )
  691. CMGetIndProfileElement            (CMProfileRef             prof,
  692.                                  unsigned long             index,
  693.                                  unsigned long *        elementSize,
  694.                                  void *                    elementData)                        FOURWORDINLINE(0x203C, 0x0010, 0x0022, 0xABEE);
  695.  
  696. EXTERN_API( CMError )
  697. CMRemoveProfileElement            (CMProfileRef             prof,
  698.                                  OSType                 tag)                                FOURWORDINLINE(0x203C, 0x0008, 0x0024, 0xABEE);
  699.  
  700. EXTERN_API( CMError )
  701. CMGetScriptProfileDescription    (CMProfileRef             prof,
  702.                                  Str255                 name,
  703.                                  ScriptCode *            code)                                FOURWORDINLINE(0x203C, 0x000C, 0x003E, 0xABEE);
  704.  
  705. EXTERN_API( CMError )
  706. CMCloneProfileRef                (CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x0042, 0xABEE);
  707.  
  708. EXTERN_API( CMError )
  709. CMGetProfileRefCount            (CMProfileRef             prof,
  710.                                  long *                    count)                                FOURWORDINLINE(0x203C, 0x0008, 0x0043, 0xABEE);
  711.  
  712. EXTERN_API( CMError )
  713. CMProfileModified                (CMProfileRef             prof,
  714.                                  Boolean *                modified)                            FOURWORDINLINE(0x203C, 0x0008, 0x0044, 0xABEE);
  715.  
  716.  
  717. /* named Color access functions */
  718. EXTERN_API( CMError )
  719. CMGetNamedColorInfo                (CMProfileRef             prof,
  720.                                  unsigned long *        deviceChannels,
  721.                                  OSType *                deviceColorSpace,
  722.                                  OSType *                PCSColorSpace,
  723.                                  unsigned long *        count,
  724.                                  StringPtr                 prefix,
  725.                                  StringPtr                 suffix)                                FOURWORDINLINE(0x203C, 0x001C, 0x0046, 0xABEE);
  726.  
  727. EXTERN_API( CMError )
  728. CMGetNamedColorValue            (CMProfileRef             prof,
  729.                                  StringPtr                 name,
  730.                                  CMColor *                deviceColor,
  731.                                  CMColor *                PCSColor)                            FOURWORDINLINE(0x203C, 0x0010, 0x0047, 0xABEE);
  732.  
  733. EXTERN_API( CMError )
  734. CMGetIndNamedColorValue            (CMProfileRef             prof,
  735.                                  unsigned long             index,
  736.                                  CMColor *                deviceColor,
  737.                                  CMColor *                PCSColor)                            FOURWORDINLINE(0x203C, 0x0010, 0x0048, 0xABEE);
  738.  
  739. EXTERN_API( CMError )
  740. CMGetNamedColorIndex            (CMProfileRef             prof,
  741.                                  StringPtr                 name,
  742.                                  unsigned long *        index)                                FOURWORDINLINE(0x203C, 0x000C, 0x0049, 0xABEE);
  743.  
  744. EXTERN_API( CMError )
  745. CMGetNamedColorName                (CMProfileRef             prof,
  746.                                  unsigned long             index,
  747.                                  StringPtr                 name)                                FOURWORDINLINE(0x203C, 0x000C, 0x004A, 0xABEE);
  748.  
  749.  
  750. /* Low-level matching functions */
  751. EXTERN_API( CMError )
  752. NCWNewColorWorld                (CMWorldRef *            cw,
  753.                                  CMProfileRef             src,
  754.                                  CMProfileRef             dst)                                FOURWORDINLINE(0x203C, 0x000C, 0x0014, 0xABEE);
  755.  
  756. EXTERN_API( CMError )
  757. CWConcatColorWorld                (CMWorldRef *            cw,
  758.                                  CMConcatProfileSet *    profileSet)                            FOURWORDINLINE(0x203C, 0x0008, 0x0015, 0xABEE);
  759.  
  760. EXTERN_API( CMError )
  761. CWNewLinkProfile                (CMProfileRef *            prof,
  762.                                  const CMProfileLocation * targetLocation,
  763.                                  CMConcatProfileSet *    profileSet)                            FOURWORDINLINE(0x203C, 0x000C, 0x0033, 0xABEE);
  764.  
  765. EXTERN_API( void )
  766. CWDisposeColorWorld                (CMWorldRef             cw)                                    FOURWORDINLINE(0x203C, 0x0004, 0x0001, 0xABEE);
  767.  
  768. EXTERN_API( CMError )
  769. CWMatchColors                    (CMWorldRef             cw,
  770.                                  CMColor *                myColors,
  771.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0002, 0xABEE);
  772.  
  773. EXTERN_API( CMError )
  774. CWCheckColors                    (CMWorldRef             cw,
  775.                                  CMColor *                myColors,
  776.                                  unsigned long             count,
  777.                                  long *                    result)                                FOURWORDINLINE(0x203C, 0x0010, 0x0003, 0xABEE);
  778.  
  779.  
  780. /* Bitmap matching */
  781. EXTERN_API( CMError )
  782. CWMatchBitmap                    (CMWorldRef             cw,
  783.                                  CMBitmap *                bitmap,
  784.                                  CMBitmapCallBackUPP     progressProc,
  785.                                  void *                    refCon,
  786.                                  CMBitmap *                matchedBitmap)                        FOURWORDINLINE(0x203C, 0x0010, 0x002C, 0xABEE);
  787.  
  788. EXTERN_API( CMError )
  789. CWCheckBitmap                    (CMWorldRef             cw,
  790.                                  const CMBitmap *        bitmap,
  791.                                  CMBitmapCallBackUPP     progressProc,
  792.                                  void *                    refCon,
  793.                                  CMBitmap *                resultBitmap)                        FOURWORDINLINE(0x203C, 0x0014, 0x002D, 0xABEE);
  794.  
  795.  
  796. /* Quickdraw-specific matching */
  797. EXTERN_API( CMError )
  798. CWMatchPixMap                    (CMWorldRef             cw,
  799.                                  PixMap *                myPixMap,
  800.                                  CMBitmapCallBackUPP     progressProc,
  801.                                  void *                    refCon)                                FOURWORDINLINE(0x203C, 0x0010, 0x0004, 0xABEE);
  802.  
  803. EXTERN_API( CMError )
  804. CWCheckPixMap                    (CMWorldRef             cw,
  805.                                  PixMap *                myPixMap,
  806.                                  CMBitmapCallBackUPP     progressProc,
  807.                                  void *                    refCon,
  808.                                  BitMap *                resultBitMap)                        FOURWORDINLINE(0x203C, 0x0014, 0x0007, 0xABEE);
  809.  
  810. EXTERN_API( CMError )
  811. NCMBeginMatching                (CMProfileRef             src,
  812.                                  CMProfileRef             dst,
  813.                                  CMMatchRef *            myRef)                                FOURWORDINLINE(0x203C, 0x000C, 0x0016, 0xABEE);
  814.  
  815. EXTERN_API( void )
  816. CMEndMatching                    (CMMatchRef             myRef)                                FOURWORDINLINE(0x203C, 0x0004, 0x000B, 0xABEE);
  817.  
  818. EXTERN_API( void )
  819. NCMDrawMatchedPicture            (PicHandle                 myPicture,
  820.                                  CMProfileRef             dst,
  821.                                  Rect *                    myRect)                                FOURWORDINLINE(0x203C, 0x000C, 0x0017, 0xABEE);
  822.  
  823. EXTERN_API( void )
  824. CMEnableMatchingComment            (Boolean                 enableIt)                            FOURWORDINLINE(0x203C, 0x0002, 0x000D, 0xABEE);
  825.  
  826. EXTERN_API( CMError )
  827. NCMUseProfileComment            (CMProfileRef             prof,
  828.                                  unsigned long             flags)                                FOURWORDINLINE(0x203C, 0x0008, 0x003B, 0xABEE);
  829.  
  830. EXTERN_API( CMError )
  831. CMCreateProfileIdentifier        (CMProfileRef             prof,
  832.                                  CMProfileIdentifierPtr  ident,
  833.                                  unsigned long *        size)                                FOURWORDINLINE(0x203C, 0x000C, 0x0041, 0xABEE);
  834.  
  835.  
  836. /* System Profile access */
  837. EXTERN_API( CMError )
  838. CMGetSystemProfile                (CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x0004, 0x0018, 0xABEE);
  839.  
  840. EXTERN_API( CMError )
  841. CMSetSystemProfile                (const FSSpec *            profileFileSpec)                    FOURWORDINLINE(0x203C, 0x0004, 0x0019, 0xABEE);
  842.  
  843. EXTERN_API( CMError )
  844. CMGetDefaultProfileBySpace        (OSType                 dataColorSpace,
  845.                                  CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005A, 0xABEE);
  846.  
  847. EXTERN_API( CMError )
  848. CMSetDefaultProfileBySpace        (OSType                 dataColorSpace,
  849.                                  CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005B, 0xABEE);
  850.  
  851. EXTERN_API( CMError )
  852. CMGetProfileByAVID                (AVIDType                 theAVID,
  853.                                  CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005C, 0xABEE);
  854.  
  855. EXTERN_API( CMError )
  856. CMSetProfileByAVID                (AVIDType                 theAVID,
  857.                                  CMProfileRef             prof)                                FOURWORDINLINE(0x203C, 0x0008, 0x005D, 0xABEE);
  858.  
  859.  
  860. /* External Profile Management */
  861. EXTERN_API( CMError )
  862. CMNewProfileSearch                (CMSearchRecord *        searchSpec,
  863.                                  void *                    refCon,
  864.                                  unsigned long *        count,
  865.                                  CMProfileSearchRef *    searchResult)                        FOURWORDINLINE(0x203C, 0x0010, 0x0027, 0xABEE);
  866.  
  867. EXTERN_API( CMError )
  868. CMUpdateProfileSearch            (CMProfileSearchRef     search,
  869.                                  void *                    refCon,
  870.                                  unsigned long *        count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0028, 0xABEE);
  871.  
  872. EXTERN_API( void )
  873. CMDisposeProfileSearch            (CMProfileSearchRef     search)                                FOURWORDINLINE(0x203C, 0x0004, 0x0029, 0xABEE);
  874.  
  875. EXTERN_API( CMError )
  876. CMSearchGetIndProfile            (CMProfileSearchRef     search,
  877.                                  unsigned long             index,
  878.                                  CMProfileRef *            prof)                                FOURWORDINLINE(0x203C, 0x000C, 0x002A, 0xABEE);
  879.  
  880. EXTERN_API( CMError )
  881. CMSearchGetIndProfileFileSpec    (CMProfileSearchRef     search,
  882.                                  unsigned long             index,
  883.                                  FSSpec *                profileFile)                        FOURWORDINLINE(0x203C, 0x000C, 0x002B, 0xABEE);
  884.  
  885. EXTERN_API( CMError )
  886. CMProfileIdentifierFolderSearch    (CMProfileIdentifierPtr  ident,
  887.                                  unsigned long *        matchedCount,
  888.                                  CMProfileSearchRef *    searchResult)                        FOURWORDINLINE(0x203C, 0x000C, 0x003F, 0xABEE);
  889.  
  890. EXTERN_API( CMError )
  891. CMProfileIdentifierListSearch    (CMProfileIdentifierPtr  ident,
  892.                                  CMProfileRef *            profileList,
  893.                                  unsigned long             listSize,
  894.                                  unsigned long *        matchedCount,
  895.                                  CMProfileRef *            matchedList)                        FOURWORDINLINE(0x203C, 0x0014, 0x0040, 0xABEE);
  896.  
  897. EXTERN_API( CMError )
  898. CMIterateColorSyncFolder        (CMProfileIterateUPP     proc,
  899.                                  unsigned long *        seed,
  900.                                  unsigned long *        count,
  901.                                  void *                    refCon)                                FOURWORDINLINE(0x203C, 0x0010, 0x0058, 0xABEE);
  902.  
  903.  
  904. /* Utilities */
  905. EXTERN_API( CMError )
  906. CMGetColorSyncFolderSpec        (short                     vRefNum,
  907.                                  Boolean                 createFolder,
  908.                                  short *                foundVRefNum,
  909.                                  long *                    foundDirID)                            FOURWORDINLINE(0x203C, 0x000C, 0x0011, 0xABEE);
  910.  
  911. EXTERN_API( CMError )
  912. CMGetCWInfo                        (CMWorldRef             cw,
  913.                                  CMCWInfoRecord *        info)                                FOURWORDINLINE(0x203C, 0x0008, 0x001A, 0xABEE);
  914.  
  915. EXTERN_API( CMError )
  916. CMConvertProfile2to1            (CMProfileRef             profv2,
  917.                                  CMProfileHandle *        profv1)                                FOURWORDINLINE(0x203C, 0x0008, 0x0045, 0xABEE);
  918.  
  919. EXTERN_API( CMError )
  920. CMGetPreferredCMM                (OSType *                cmmType,
  921.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0008, 0x005E, 0xABEE);
  922.  
  923.  
  924.  
  925. /* ColorSpace conversion functions */
  926. EXTERN_API( CMError )
  927. CMConvertXYZToLab                (const CMColor *        src,
  928.                                  const CMXYZColor *        white,
  929.                                  CMColor *                dst,
  930.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004B, 0xABEE);
  931.  
  932. EXTERN_API( CMError )
  933. CMConvertLabToXYZ                (const CMColor *        src,
  934.                                  const CMXYZColor *        white,
  935.                                  CMColor *                dst,
  936.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004C, 0xABEE);
  937.  
  938. EXTERN_API( CMError )
  939. CMConvertXYZToLuv                (const CMColor *        src,
  940.                                  const CMXYZColor *        white,
  941.                                  CMColor *                dst,
  942.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004D, 0xABEE);
  943.  
  944. EXTERN_API( CMError )
  945. CMConvertLuvToXYZ                (const CMColor *        src,
  946.                                  const CMXYZColor *        white,
  947.                                  CMColor *                dst,
  948.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x0010, 0x004E, 0xABEE);
  949.  
  950. EXTERN_API( CMError )
  951. CMConvertXYZToYxy                (const CMColor *        src,
  952.                                  CMColor *                dst,
  953.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x004F, 0xABEE);
  954.  
  955. EXTERN_API( CMError )
  956. CMConvertYxyToXYZ                (const CMColor *        src,
  957.                                  CMColor *                dst,
  958.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0050, 0xABEE);
  959.  
  960. EXTERN_API( CMError )
  961. CMConvertRGBToHLS                (const CMColor *        src,
  962.                                  CMColor *                dst,
  963.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0051, 0xABEE);
  964.  
  965. EXTERN_API( CMError )
  966. CMConvertHLSToRGB                (const CMColor *        src,
  967.                                  CMColor *                dst,
  968.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0052, 0xABEE);
  969.  
  970. EXTERN_API( CMError )
  971. CMConvertRGBToHSV                (const CMColor *        src,
  972.                                  CMColor *                dst,
  973.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0053, 0xABEE);
  974.  
  975. EXTERN_API( CMError )
  976. CMConvertHSVToRGB                (const CMColor *        src,
  977.                                  CMColor *                dst,
  978.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0054, 0xABEE);
  979.  
  980. EXTERN_API( CMError )
  981. CMConvertRGBToGray                (const CMColor *        src,
  982.                                  CMColor *                dst,
  983.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0055, 0xABEE);
  984.  
  985. EXTERN_API( CMError )
  986. CMConvertXYZToFixedXYZ            (const CMXYZColor *        src,
  987.                                  CMFixedXYZColor *        dst,
  988.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0056, 0xABEE);
  989.  
  990. EXTERN_API( CMError )
  991. CMConvertFixedXYZToXYZ            (const CMFixedXYZColor * src,
  992.                                  CMXYZColor *            dst,
  993.                                  unsigned long             count)                                FOURWORDINLINE(0x203C, 0x000C, 0x0057, 0xABEE);
  994.  
  995. /* PS-related */
  996. EXTERN_API( CMError )
  997. CMGetPS2ColorSpace                (CMProfileRef             srcProf,
  998.                                  unsigned long             flags,
  999.                                  CMFlattenUPP             proc,
  1000.                                  void *                    refCon,
  1001.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0014, 0x002E, 0xABEE);
  1002.  
  1003. EXTERN_API( CMError )
  1004. CMGetPS2ColorRenderingIntent    (CMProfileRef             srcProf,
  1005.                                  unsigned long             flags,
  1006.                                  CMFlattenUPP             proc,
  1007.                                  void *                    refCon,
  1008.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0014, 0x002F, 0xABEE);
  1009.  
  1010. EXTERN_API( CMError )
  1011. CMGetPS2ColorRendering            (CMProfileRef             srcProf,
  1012.                                  CMProfileRef             dstProf,
  1013.                                  unsigned long             flags,
  1014.                                  CMFlattenUPP             proc,
  1015.                                  void *                    refCon,
  1016.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0018, 0x0030, 0xABEE);
  1017.  
  1018. EXTERN_API( CMError )
  1019. CMGetPS2ColorRenderingVMSize    (CMProfileRef             srcProf,
  1020.                                  CMProfileRef             dstProf,
  1021.                                  unsigned long *        vmSize,
  1022.                                  Boolean *                preferredCMMnotfound)                FOURWORDINLINE(0x203C, 0x0010, 0x003D, 0xABEE);
  1023.  
  1024.  
  1025. /* ColorSync 1.0 functions which have parallel 2.0 counterparts */
  1026. EXTERN_API( CMError )
  1027. CWNewColorWorld                    (CMWorldRef *            cw,
  1028.                                  CMProfileHandle         src,
  1029.                                  CMProfileHandle         dst)                                FOURWORDINLINE(0x203C, 0x000C, 0x0000, 0xABEE);
  1030.  
  1031. EXTERN_API( CMError )
  1032. ConcatenateProfiles                (CMProfileHandle         thru,
  1033.                                  CMProfileHandle         dst,
  1034.                                  CMProfileHandle *        newDst)                                FOURWORDINLINE(0x203C, 0x000C, 0x000C, 0xABEE);
  1035.  
  1036. EXTERN_API( CMError )
  1037. CMBeginMatching                    (CMProfileHandle         src,
  1038.                                  CMProfileHandle         dst,
  1039.                                  CMMatchRef *            myRef)                                FOURWORDINLINE(0x203C, 0x000C, 0x000A, 0xABEE);
  1040.  
  1041. EXTERN_API( void )
  1042. CMDrawMatchedPicture            (PicHandle                 myPicture,
  1043.                                  CMProfileHandle         dst,
  1044.                                  Rect *                    myRect)                                FOURWORDINLINE(0x203C, 0x000C, 0x0009, 0xABEE);
  1045.  
  1046. EXTERN_API( CMError )
  1047. CMUseProfileComment                (CMProfileHandle         profile)                            FOURWORDINLINE(0x203C, 0x0004, 0x0008, 0xABEE);
  1048.  
  1049. EXTERN_API( void )
  1050. CMGetProfileName                (CMProfileHandle         myProfile,
  1051.                                  CMIString *            IStringResult)                        FOURWORDINLINE(0x203C, 0x0008, 0x000E, 0xABEE);
  1052.  
  1053. EXTERN_API( long )
  1054. CMGetProfileAdditionalDataOffset (CMProfileHandle         myProfile)                            FOURWORDINLINE(0x203C, 0x0004, 0x000F, 0xABEE);
  1055.  
  1056.  
  1057. /* ProfileResponder functions */
  1058. EXTERN_API( CMError )
  1059. GetProfile                        (OSType                 deviceType,
  1060.                                  long                     refNum,
  1061.                                  CMProfileHandle         aProfile,
  1062.                                  CMProfileHandle *        returnedProfile)                    FOURWORDINLINE(0x203C, 0x0010, 0x0005, 0xABEE);
  1063.  
  1064. EXTERN_API( CMError )
  1065. SetProfile                        (OSType                 deviceType,
  1066.                                  long                     refNum,
  1067.                                  CMProfileHandle         newProfile)                            FOURWORDINLINE(0x203C, 0x000C, 0x0006, 0xABEE);
  1068.  
  1069. EXTERN_API( CMError )
  1070. SetProfileDescription            (OSType                 deviceType,
  1071.                                  long                     refNum,
  1072.                                  long                     deviceData,
  1073.                                  CMProfileHandle         hProfile)                            FOURWORDINLINE(0x203C, 0x0010, 0x0010, 0xABEE);
  1074.  
  1075. EXTERN_API( CMError )
  1076. GetIndexedProfile                (OSType                 deviceType,
  1077.                                  long                     refNum,
  1078.                                  CMProfileSearchRecordHandle  search,
  1079.                                  CMProfileHandle *        returnProfile,
  1080.                                  long *                    index)                                FOURWORDINLINE(0x203C, 0x0014, 0x0012, 0xABEE);
  1081.  
  1082. EXTERN_API( CMError )
  1083. DeleteDeviceProfile                (OSType                 deviceType,
  1084.                                  long                     refNum,
  1085.                                  CMProfileHandle         deleteMe)                            FOURWORDINLINE(0x203C, 0x000C, 0x0013, 0xABEE);
  1086.  
  1087.  
  1088. #if OLDROUTINENAMES
  1089. /* constants */
  1090.  
  1091. typedef CMFlattenProcPtr                 CMFlattenProc;
  1092. typedef CMBitmapCallBackProcPtr         CMBitmapCallBackProc;
  1093. typedef CMProfileFilterProcPtr             CMProfileFilterProc;
  1094.  
  1095. enum {
  1096.     CMTrap                        = cmTrap,
  1097.     CMBeginProfile                = cmBeginProfile,
  1098.     CMEndProfile                = cmEndProfile,
  1099.     CMEnableMatching            = cmEnableMatching,
  1100.     CMDisableMatching            = cmDisableMatching
  1101. };
  1102.  
  1103. /* 1.0 Error codes, for compatibility with older applications. 1.0 CMM's may return obsolete error codes */
  1104.  
  1105. enum {
  1106.     CMNoError                    = 0,                            /*    obsolete name, use noErr */
  1107.     CMProfileError                = cmProfileError,
  1108.     CMMethodError                = cmMethodError,
  1109.     CMMemFullError                = -172,                            /*    obsolete, 2.0 uses memFullErr */
  1110.     CMUnimplementedError        = -173,                            /*    obsolete, 2.0 uses unimpErr */
  1111.     CMParamError                = -174,                            /*    obsolete, 2.0 uses paramErr */
  1112.     CMMethodNotFound            = cmMethodNotFound,
  1113.     CMProfileNotFound            = cmProfileNotFound,
  1114.     CMProfilesIdentical            = cmProfilesIdentical,
  1115.     CMCantConcatenateError        = cmCantConcatenateError,
  1116.     CMCantXYZ                    = cmCantXYZ,
  1117.     CMCantDeleteProfile            = cmCantDeleteProfile,
  1118.     CMUnsupportedDataType        = cmUnsupportedDataType,
  1119.     CMNoCurrentProfile            = cmNoCurrentProfile
  1120. };
  1121.  
  1122.  
  1123. enum {
  1124.     qdSystemDevice                = cmSystemDevice,
  1125.     qdGDevice                    = cmGDevice
  1126. };
  1127.  
  1128.  
  1129. enum {
  1130.     kMatchCMMType                = cmMatchCMMType,
  1131.     kMatchApplProfileVersion    = cmMatchApplProfileVersion,
  1132.     kMatchDataType                = cmMatchDataType,
  1133.     kMatchDeviceType            = cmMatchDeviceType,
  1134.     kMatchDeviceManufacturer    = cmMatchDeviceManufacturer,
  1135.     kMatchDeviceModel            = cmMatchDeviceModel,
  1136.     kMatchDeviceAttributes        = cmMatchDeviceAttributes,
  1137.     kMatchFlags                    = cmMatchFlags,
  1138.     kMatchOptions                = cmMatchOptions,
  1139.     kMatchWhite                    = cmMatchWhite,
  1140.     kMatchBlack                    = cmMatchBlack
  1141. };
  1142.  
  1143. /* types */
  1144. typedef CMCMYKColor                     CMYKColor;
  1145. typedef CMWorldRef                         CWorld;
  1146. typedef long *                            CMGamutResult;
  1147. /* functions */
  1148. #define EndMatching(myRef)                                                        CMEndMatching(myRef)
  1149. #define EnableMatching(enableIt)                                                CMEnableMatchingComment(enableIt)
  1150. #define GetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)    CMGetColorSyncFolderSpec(vRefNum, createFolder, foundVRefNum, foundDirID)
  1151. #define BeginMatching(src, dst, myRef)                                            CMBeginMatching(src, dst, myRef)
  1152. #define DrawMatchedPicture(myPicture, dst, myRect)                                CMDrawMatchedPicture(myPicture, dst, myRect)
  1153. #define UseProfile(profile)                                                        CMUseProfileComment(profile)
  1154. #define GetProfileName(myProfile, IStringResult)                                CMGetProfileName(myProfile, IStringResult)
  1155. #define GetProfileAdditionalDataOffset(myProfile)                                CMGetProfileAdditionalDataOffset(myProfile)
  1156. #endif  /* OLDROUTINENAMES */
  1157.  
  1158.  
  1159. /* Deprecated stuff*/
  1160.  
  1161. /* PrGeneral parameter blocks */
  1162.  
  1163. struct TEnableColorMatchingBlk {
  1164.     short                             iOpCode;
  1165.     short                             iError;
  1166.     long                             lReserved;
  1167.     THPrint                         hPrint;
  1168.     Boolean                         fEnableIt;
  1169.     SInt8                             filler;
  1170. };
  1171. typedef struct TEnableColorMatchingBlk    TEnableColorMatchingBlk;
  1172.  
  1173. struct TRegisterProfileBlk {
  1174.     short                             iOpCode;
  1175.     short                             iError;
  1176.     long                             lReserved;
  1177.     THPrint                         hPrint;
  1178.     Boolean                         fRegisterIt;
  1179.     SInt8                             filler;
  1180. };
  1181. typedef struct TRegisterProfileBlk        TRegisterProfileBlk;
  1182.  
  1183. #if PRAGMA_STRUCT_ALIGN
  1184.     #pragma options align=reset
  1185. #elif PRAGMA_STRUCT_PACKPUSH
  1186.     #pragma pack(pop)
  1187. #elif PRAGMA_STRUCT_PACK
  1188.     #pragma pack()
  1189. #endif
  1190.  
  1191. #ifdef PRAGMA_IMPORT_OFF
  1192. #pragma import off
  1193. #elif PRAGMA_IMPORT
  1194. #pragma import reset
  1195. #endif
  1196.  
  1197. #ifdef __cplusplus
  1198. }
  1199. #endif
  1200.  
  1201. #endif /* __CMAPPLICATION__ */
  1202.  
  1203.